-
Couldn't load subscription status.
- Fork 146
Use auto aliasing for cases for the runopt #1143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3ac3a1e to
61bdfa7
Compare
Summary:
Introduces enum for auto aliasing based on casing for the runopt nam
```
class AutoAlias(IntEnum):
snake_case = 0x1
SNAKE_CASE = 0x2
camelCase = 0x4
```
So user can extend name to be used as
```
opts.add(
["job_priority", runopt.AutoAlias.camelCase],
type_=str,
help="run as user",
)
opts.add(
[
"model_type_name",
runopt.AutoAlias.camelCase | runopt.AutoAlias.SNAKE_CASE,
],
type_=str,
help="run as user",
)
```
This should automatically produce additional aliases of `jobPriority` to `job_priority` and produce `modelTypeName` and `MODEL_TYPE_NAME` for `model_type_name`
Differential Revision: D84192560
Summary:
Introduces enum for auto aliasing based on casing for the runopt nam
```
class AutoAlias(IntEnum):
snake_case = 0x1
SNAKE_CASE = 0x2
camelCase = 0x4
```
So user can extend name to be used as
```
opts.add(
["job_priority", runopt.AutoAlias.camelCase],
type_=str,
help="run as user",
)
opts.add(
[
"model_type_name",
runopt.AutoAlias.camelCase | runopt.AutoAlias.SNAKE_CASE,
],
type_=str,
help="run as user",
)
```
This should automatically produce additional aliases of `jobPriority` to `job_priority` and produce `modelTypeName` and `MODEL_TYPE_NAME` for `model_type_name`
Differential Revision: D84192560
61bdfa7 to
fb3ce28
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1143 +/- ##
==========================================
+ Coverage 91.64% 91.69% +0.04%
==========================================
Files 83 83
Lines 6440 6537 +97
==========================================
+ Hits 5902 5994 +92
- Misses 538 543 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary:
Introduces enum for auto aliasing based on casing for the runopt nam
```
class AutoAlias(IntEnum):
snake_case = 0x1
SNAKE_CASE = 0x2
camelCase = 0x4
```
So user can extend name to be used as
```
opts.add(
["job_priority", runopt.AutoAlias.camelCase],
type_=str,
help="run as user",
)
opts.add(
[
"model_type_name",
runopt.AutoAlias.camelCase | runopt.AutoAlias.SNAKE_CASE,
],
type_=str,
help="run as user",
)
```
This should automatically produce additional aliases of `jobPriority` to `job_priority` and produce `modelTypeName` and `MODEL_TYPE_NAME` for `model_type_name`
Reviewed By: kiukchung
Differential Revision: D84192560
fb3ce28 to
7ea8507
Compare
Summary: Lets allow aliases for a runopt. This will give downstream users to have multiple ways of accessing the same runopt. * Introduce new class for `runopt.alias` which is used to expand on adding aliases to a runopt. * Add a new dict to maintain alias to key values that can be used by `opt.get(name)` * Modify add() to accept list as well, build out the aliases list and modify the previously created dict to fill in alias to primary_key values. * Modify resolve() to check if a different alias is already used in cfg i.e if the "jobPriority" and "job_priority" are aliases for the same one, we don't allow for both to be present in the cfg. * Modify get to look at the alias to primary_key dict as well. Reviewed By: kiukchung Differential Revision: D84157870
Summary: Similar to `runopt.alias` lets introduce and use `runopt.deprecated`. This will warn the user with a`UserWarning` when the user uses that specific name and suggests the primary one instead. Reviewed By: kiukchung Differential Revision: D84180061
Summary:
Introduces enum for auto aliasing based on casing for the runopt nam
```
class AutoAlias(IntEnum):
snake_case = 0x1
SNAKE_CASE = 0x2
camelCase = 0x4
```
So user can extend name to be used as
```
opts.add(
["job_priority", runopt.AutoAlias.camelCase],
type_=str,
help="run as user",
)
opts.add(
[
"model_type_name",
runopt.AutoAlias.camelCase | runopt.AutoAlias.SNAKE_CASE,
],
type_=str,
help="run as user",
)
```
This should automatically produce additional aliases of `jobPriority` to `job_priority` and produce `modelTypeName` and `MODEL_TYPE_NAME` for `model_type_name`
Reviewed By: kiukchung
Differential Revision: D84192560
7ea8507 to
f7df09b
Compare
Summary:
Introduces enum for auto aliasing based on casing for the runopt nam
So user can extend name to be used as
This should automatically produce additional aliases of
jobPrioritytojob_priorityand producemodelTypeNameandMODEL_TYPE_NAMEformodel_type_nameDifferential Revision: D84192560